﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AwesomeEnginePC.Extentions
{
    public static class ExtMedIntBasics
    {
        /// <summary>
        /// Tests to see if a number is between an inclusive set of values.
        /// </summary>
        /// <param name="value">The number to test.</param>
        /// <param name="min">The minimum inclusive bound.</param>
        /// <param name="max">The maximum inclusive bound.</param>
        /// <returns>True if value is within bounds. Else, false.</returns>
        public static bool IsWithinRange(this int value, int min, int max)
        {
            return (min <= value && value <= max);
        }

        /// <summary>
        /// Tests to see if a number is between a set of values.
        /// </summary>
        /// <param name="value">The number to test.</param>
        /// <param name="min">The minimum bound.</param>
        /// <param name="max">The maximum bound.</param>
        /// <param name="isInclusive">Tells whether the check makes the bounds inclusive or exclusive.</param>
        /// <returns></returns>
        public static bool IsWithinRange(this int value, int min, int max, bool isInclusive)
        {
            if (isInclusive)
            {
                return (min <= value && value <= max);
            }
            else
            {
                return (min < value && value < max);
            }
        }
    }
}
